package com.han.walkman.service.impl;

import com.han.walkman.dao.ProductionDao;
import com.han.walkman.entity.ProductionEntity;
import com.han.walkman.service.ProductionService;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @Author: Hanjiafeng
 * @Date: 2020/5/7
 * @Desc: 轮播图操作实现类
 */
@Service
public class ProductionServiceImpl implements ProductionService {
    private final ProductionDao productionDao;

    public ProductionServiceImpl(ProductionDao productionDao) {
        this.productionDao = productionDao;
    }

    @Override
    public void add(ProductionEntity productionEntity) {
        productionDao.save(productionEntity);
    }

    @Override
    public void delete(ProductionEntity productionEntity) {
        productionDao.delete(productionEntity);
    }

    @Override
    public void update(ProductionEntity productionEntity) {
        productionDao.save(productionEntity);
    }

    @Override
    public List<ProductionEntity> findAll() {
        return productionDao.findAll();
    }

    @Override
    public Page<ProductionEntity> findAll(Pageable pageable) {
        return productionDao.findAll(pageable);
    }

    @Override
    public List<ProductionEntity> findAll(Example<ProductionEntity> entityExample) {
        return productionDao.findAll(entityExample);
    }

    @Override
    public Page<ProductionEntity> findAll(Example<ProductionEntity> entityExample, Pageable pageable) {
        return productionDao.findAll(entityExample, pageable);
    }

    @Override
    public Optional<ProductionEntity> findById(Integer id) {
        return productionDao.findById(id);
    }
}